package com.example.sys.org.form;

import com.example.core.convert.form.FormConvertor_IDToModel;
import com.example.core.convert.form.FormConvertor_IDToModelList;
import com.example.core.convert.FormToModelPropertyMap;
import com.example.core.form.BaseForm;
import com.example.sys.module.annotation.SysField;
import com.example.sys.module.annotation.SysModule;
import com.example.sys.org.model.SysOrgAddress;
import com.example.sys.org.model.SysOrgRole;
import com.example.sys.org.model.SysOrgUser;
import lombok.Getter;
import lombok.Setter;


@Setter
@Getter
@SysModule(comment = "用户信息", entityClass = SysOrgUser.class)
public class SysOrgUserForm extends BaseForm<SysOrgUserForm> {

    @SysField(comment = "姓名")
    private String fdName;

    @SysField(comment = "排序号")
    private int fdOrderNum;

    @SysField(comment = "类型")
    protected int fdOrgType;

    @SysField(comment = "层级")
    private String fdHierarchyId;

    @SysField(comment = "用户名")
    private String fdUserName;

    @SysField(comment = "密码")
    private String fdPassWord;

    @SysField(comment = "地址")
    private String fdAddressId;

    @SysField(comment = "地址")
    private String fdAddressName;

    @SysField(comment = "包含角色")
    private String fdRolesId;

    @SysField(comment = "包含角色")
    private String fdRolesName;

    @Override
    public FormToModelPropertyMap getToModelPropertyMap() {
        FormToModelPropertyMap toModelPropertyMap = super.getToModelPropertyMap();
        toModelPropertyMap.put("fdAddressId", new FormConvertor_IDToModel("fdAddress", SysOrgAddress.class));
        toModelPropertyMap.put("fdRolesId", new FormConvertor_IDToModelList("fdRoles", SysOrgRole.class));
        return toModelPropertyMap;
    }

    @Override
    public Class<?> getModelClass() {
        return SysOrgUser.class;
    }
}
